package com.sws.device.domain.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * WebSocket消息模型
 * 用于WebSocket通信的基本消息格式
 */
@Data
@ApiModel(description = "WebSocket消息模型，用于WebSocket通信的基本消息格式")
public class WebSocketMessage {
    // 消息ID
    @ApiModelProperty(value = "消息ID", example = "12345")
    private String msgid;
    // 认证令牌
    @ApiModelProperty(value = "认证令牌", example = "token123")
    private String token;
    // 数据
    @ApiModelProperty(value = "消息数据", dataType = "MessageData")
    private MessageData data;

    @Data
    @ApiModel(description = "WebSocket消息数据模型，包含操作URI、参数、状态码、消息和结果")
    public static class MessageData {
        // 操作URI
        @ApiModelProperty(value = "操作URI", example = "/api/example")
        private String uri;
        // 参数
        @ApiModelProperty(value = "参数", example = "{\"key\":\"value\"}")
        private Object param;
        // 状态码
        @ApiModelProperty(value = "状态码", example = "200")
        private Integer code;
        // 消息
        @ApiModelProperty(value = "消息", example = "操作成功")
        private String msg;
        // 结果
        @ApiModelProperty(value = "结果", example = "{\"result\":\"success\"}")
        private Object result;
    }
}